import mx.managers.PopUpManager;

import views.ViewInstance;
import views.copyright.AddCopyrightAction;
import views.firm.NewMatter;
import views.invention.AddFieldAction;
import views.invention.AddInvention;
import views.invention.AddOfficeAction;
import views.invention.GetDate;
import views.invention.ProtectTrade;
import views.invention.RenewalFee;
import views.invention.UpdateInvention;
import views.mark.AddTradeMarkAction;
import views.user.AddClient;
import views.user.AddInventor;
import views.user.AddPractitioner;
import views.user.ChangePassword;
import views.user.EditBilling;
import views.user.EditFirm;
import views.user.EditPersonInformation;
import views.welcome.Login;
import views.welcome.Register;
private var _view:int;

public function set view(value:int):void
{
	_view	=	value;
	switch(value)
	{
		case ViewInstance.Register:
			var register:Register	=	
				PopUpManager.createPopUp(this,views.welcome.Register,true) as Register;	
			PopUpManager.bringToFront(register);
			break;
		case ViewInstance.Login:
			var login:Login	=	
				PopUpManager.createPopUp(this,views.welcome.Login,true) as Login;	
			PopUpManager.bringToFront(login);
			break;
		case ViewInstance.AddInvention:
			var addInvention:AddInvention	=	
				PopUpManager.createPopUp(this,AddInvention,true) as AddInvention;	
			PopUpManager.bringToFront(addInvention);
			break;
		case ViewInstance.EditPersonalInformation:
			var editPersonInformation:EditPersonInformation	=	
				PopUpManager.createPopUp(this,EditPersonInformation,true) as EditPersonInformation;	
			PopUpManager.bringToFront(editPersonInformation);
			break;
		case ViewInstance.ChangePassword:
			var changePassword:ChangePassword	=	
				PopUpManager.createPopUp(this,ChangePassword,true) as ChangePassword;	
			PopUpManager.bringToFront(changePassword);
			//this.addChild(new ChangePassword());
			break;
		case ViewInstance.EditBilling:
			var editBilling:EditBilling	=	
				PopUpManager.createPopUp(this,EditBilling,true) as EditBilling;	
			PopUpManager.bringToFront(editBilling);
			break;
		case ViewInstance.AddInventor:
			trace("add inventor ..");
			try
			{
				var addInventor:AddInventor	=	
				PopUpManager.createPopUp(this,AddInventor,true) as AddInventor;	
			PopUpManager.bringToFront(addInventor);
			}
			catch(error:Error)
			{
				trace(error.getStackTrace());
			}
			
			
			break;
		case ViewInstance.EditFirm:
			var editFirm:EditFirm	=	
				PopUpManager.createPopUp(this,EditFirm,true) as EditFirm;	
			PopUpManager.bringToFront(editFirm);
			break;
		case ViewInstance.AddClient:
			var addClient:AddClient	=	
				PopUpManager.createPopUp(this,AddClient,true) as AddClient;	
			PopUpManager.bringToFront(addClient);
			break;
		case ViewInstance.AddPractitioner:
			var addPractitioner:AddPractitioner	=	
				PopUpManager.createPopUp(this,AddPractitioner,true) as AddPractitioner;	
			PopUpManager.bringToFront(addPractitioner);
			break;
		case ViewInstance.UpdateBasicInformation:
			var updateBasicInformation:UpdateInvention	=	
				PopUpManager.createPopUp(this,UpdateInvention,true) as UpdateInvention;	
			PopUpManager.bringToFront(updateBasicInformation);
			break;
		case ViewInstance.RenewalFee:
			var renewalFee:RenewalFee	=	
				PopUpManager.createPopUp(this,RenewalFee,true) as RenewalFee;	
			PopUpManager.bringToFront(renewalFee);
			break;
		case ViewInstance.AddFieldAction:
			var addFieldAction:AddFieldAction	=	
				PopUpManager.createPopUp(this,AddFieldAction,true) as AddFieldAction;	
			PopUpManager.bringToFront(addFieldAction);
			break;
		case ViewInstance.AddOfficeAction:
			var addOfficeAction:AddOfficeAction	=	
				PopUpManager.createPopUp(this,AddOfficeAction,true) as AddOfficeAction;	
			PopUpManager.bringToFront(addOfficeAction);
			break;
		case ViewInstance.GetDate:
			var getDate:GetDate	=	
				PopUpManager.createPopUp(this,GetDate,true) as GetDate;	
			PopUpManager.bringToFront(getDate);
			break;
		case ViewInstance.ProtectTrade:
			var protectTrade:ProtectTrade	=	
				PopUpManager.createPopUp(this,ProtectTrade,true) as ProtectTrade;	
			PopUpManager.bringToFront(protectTrade);
			break;
		case ViewInstance.AddTradeMarkAction:
			var addTradeMarkAction:AddTradeMarkAction	=	
				PopUpManager.createPopUp(this,AddTradeMarkAction,true) as AddTradeMarkAction;	
			PopUpManager.bringToFront(addTradeMarkAction);
			break;
		case ViewInstance.AddCopyrightAction:
			var addCopyrightAction:AddCopyrightAction	=	
				PopUpManager.createPopUp(this,AddCopyrightAction,true) as AddCopyrightAction;	
			PopUpManager.bringToFront(addCopyrightAction);
			break;
		case ViewInstance.NewMatter:
			var newMatter:NewMatter	=	
				PopUpManager.createPopUp(this,NewMatter,true) as NewMatter;	
			PopUpManager.bringToFront(newMatter);
			break;
	}
}

public function get view():int
{
	return _view;
}